local jigong = fk.CreateSkill{
  name = "wk_heg__jigong",
}

Fk:loadTranslationTable{
  ["wk_heg__jigong"] = "急攻",
  [":wk_heg__jigong"] = "回合开始时，你可令你本回合所有阶段均改为出牌阶段直至你造成伤害，且此回合结束时，若你本回合未造成过伤害，你弃置所有牌。",
 
  ["$wk_heg__jigong1"] = "不惜一切代价，拿下此人！",
  ["$wk_heg__jigong2"] = "曹贼势颓，主公速击之。",
}

jigong:addEffect(fk.TurnStart, {
  anim_type = "special",
  on_use = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "wk_heg__jigong-turn", 1)
  end,
})
  
jigong:addEffect(fk.TurnEnd, {
  is_delay_effect = true,
  anim_type = "negative",
  can_trigger = function(self, event, target, player, data)
    return player == target and player:usedSkillTimes(jigong.name, Player.HistoryTurn) > 0 and player:getMark("wk_heg__jigong-turn") > 0
  end,
  on_use = function(self, event, target, player, data)
    player:throwAllCards("he", jigong.name)
  end,
})

jigong:addEffect(fk.EventPhaseChanging, {
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    if not (player == target and player:usedSkillTimes(jigong.name, Player.HistoryTurn) > 0 and player:getMark("wk_heg__jigong-turn") > 0) then return false end
    return (data.phase == Player.Start or data.phase == Player.Judge or data.phase == Player.Draw 
       or data.phase == Player.Play or data.phase == Player.Discard or data.phase == Player.Finish)
  end,
  on_use = function(self, event, target, player, data)
    data.phase = Player.Play
  end,
})

jigong:addEffect(fk.Damage, {
  can_refresh = function(self, event, target, player, data)
    return player == target and player:getMark("wk_heg__jigong-turn") > 0
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:setPlayerMark(player, "wk_heg__jigong-turn", 0)
  end,
})

return jigong